package chap3

import scala.collection.mutable.ArrayBuffer

object Chap3 {
 
//  def aryFetch(aryInt: Array[T]): Array[T]={
//     var first = true
//     val indexes = for(i <- 0 until aryInt.length if first || aryInt(i) >= 0 ) yield {
//       if(aryInt(i) < 0 ) first = true;i 
//     }
////     indexes
//     
//  }
  def pary(args:ArrayBuffer[Int]){
    args.foreach { println(_) }
  }
  def main(args: Array[String]): Unit = {
    val a = Array(-1,-2,2,3,5,7,11)
    var b = ArrayBuffer[Int]()
     var first = true
     val indexes = for(i <- 0 until a.length if a(i) < 0 ) yield i
     
//     for(j <- (1 until indexes.length).reverse) a..remove(indexes(j))
     var a2 = for(ele <- a){
       if(!indexes.drop(1).contains(ele)) b.+=(ele)
     }
     pary(b)     
     
  }
}
